<template>
  <div class="ele-body">
    <el-card shadow="never">
      <ele-pro-table
          ref="table"
          :where="where"
          :datasource="url"
          :columns="columns"
          height="calc(100vh - 315px)">
        <template slot="avatar" slot-scope="{row}">
          <el-avatar shape="square" :size="25" :src="row.avatar"/>
        </template>
      </ele-pro-table>
    </el-card>
  </div>
</template>

<script>

export default {
  data() {
    return {
      url: '/open_log/index',
      columns: [
        {
          prop: 'id',
          label: 'ID',
          width: 60,
          align: 'center',
          showOverflowTooltip: true,
          fixed: "left"
        },
        {
          prop: 'name',
          label: '操作人',
          showOverflowTooltip: true,
          minWidth: 100,
          align: 'center',
        },
        {
          prop: 'code',
          label: '学号/手机号',
          showOverflowTooltip: true,
          minWidth: 150,
          align: 'center',
        },
        {
          prop: 'create_time',
          label: '开门时间',
          showOverflowTooltip: true,
          minWidth: 160,
          align: 'center',
          formatter: (row, column, cellValue) => {
            return this.$util.toDateString(cellValue);
          }
        }
      ],
      where: {}
    }
  },
  methods: {
    reload() {
      this.$refs.table.reload({where: this.where})
    },
    reset() {
      this.where = {}
      this.reload()
    }
  }
}
</script>